package com.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.order.pojo.OrderDetail;
import com.order.mapper.OrderDetailMapper;
import com.order.pojo.OrderMaster;
import com.order.service.IOrderDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cucu
 * @since 2025-08-11
 */
@Service
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements IOrderDetailService {

    @Autowired
    OrderDetailMapper orderDetailMapper;

    @Override
    public PageInfo<OrderDetail> getOrderDetailByPage(Integer page, Integer size, OrderDetail orderDetail) {
        PageHelper.startPage(page, size);
        QueryWrapper<OrderDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(true, "order_id", orderDetail.getOrderId());
        queryWrapper.eq(true, "del", 0);
        List<OrderDetail> orderDetailList = orderDetailMapper.selectList(queryWrapper);
        return PageInfo.of(orderDetailList);
    }
}
